<template>
  <div>
    <data-page
      :tableData="props.domain.tableData"
      :columns="props.domain.columns"
      :tableProperty="tableProperty"
      :tableEvent="tableEvent"
    />
  </div>
</template>

<script lang="ts" setup>
import DataPage from "@/components/DataPage/index.vue";
defineOptions({
  name: "TemplateDomain"
});
const props = defineProps({
  domain: {
    type: Object,
    default() {
      return {
        tableData: [],
        columns: [],
        table: {
          tableProperty: {},
          tableEvent: {}
        },
        form: {},
        query: {}
      };
    }
  }
});
// eslint-disable-next-line vue/no-setup-props-destructure
const {
  border,
  align,
  height,
  stripe,
  rowClassName,
  highlightCurrentRow,
  indexMethod,
  defaultSort
} = props.domain.table.tableProperty;
const tableProperty = {
  border: border ? border : false,
  align: align ? align : "center",
  height: height ? height : "100%",
  stripe: stripe ? stripe : false,
  rowClassName: rowClassName ? rowClassName : "",
  highlightCurrentRow: highlightCurrentRow ? highlightCurrentRow : false,
  indexMethod: indexMethod ? indexMethod : 0,
  defaultSort: defaultSort ? defaultSort : {}
};
// eslint-disable-next-line vue/no-setup-props-destructure
const { handleCurrentChange, handleSelectionChange } =
  props.domain.table.tableEvent;
const tableEvent = {
  handleCurrentChange: handleCurrentChange ? handleCurrentChange : null,
  handleSelectionChange: handleSelectionChange ? handleSelectionChange : null
};
console.log("ccc", handleCurrentChange);
console.log("tableProperty", tableProperty);
</script>

<style scoped></style>
